<?php
class indexControl extends Control{
    function index(){
    	$_SESSION['username']="zyh";
		if(!empty($_SESSION['username'])){
		$this->assign("username",$_SESSION['username']);
		$this->display();
		}else{
		$this->go("index/login");
		}

    }
	function login(){//登录页面
	$this->display();
	}
	function wel(){//欢迎页面
	
	$this->display();
	}
	function out(){//退出
	$_SESSION=array();
	$this->go("index/login");
	}
	function upload(){//上传页面
		$db=M('img_cate');
		$cate=$db->all();
		$this->assign("cate",$cate);
		$this->display();
	}
	function images(){
		$db=M("upload");
		$row=$db->all();
		$this->assign("row",$row);
		$this->display();

	}
	function upload_add(){
		$db=M("upload");
		foreach ($_POST['thumb'] as  $v) {
			$_POST['thumb']=__ROOT__."/".$v[0];
			$row=$db->add();
			# code...
		}
		if($db->get_affected_rows()){
			$this->success("上传成功");
		}else{
			$this->error("再努力的想想吧");
		}
	
	}
	
}